//
//  SIAboutViewController.m
//  CampingLight
//
//  Created by Piccolo on 2018/6/30.
//  Copyright © 2018 SmartIT. All rights reserved.
//

#import "SIAboutViewController.h"

@interface SIAboutViewController () {
    
    __weak IBOutlet UILabel *_copyrightLabel;
    __weak IBOutlet UILabel *_emailLabel;
    __weak IBOutlet UILabel *_IDLabel;
    __weak IBOutlet UILabel *_hardwareLabel;
    __weak IBOutlet UILabel *_softwareLabel;
    __weak IBOutlet UILabel *_firmwareLabel;
}

@end

@implementation SIAboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupNavigationBar];
    [self setupAboutValue];
}

- (void)setupNavigationBar {
    
    self.navigationItem.title = [SIUtil getSingleKeyStr:@"TEXT_ABOUT"];
    UIBarButtonItem *backItem = [SIUtil newBarItemWithImageName:@"ico-back.png" target:self action:@selector(backBtnOnClick:)];
    self.navigationItem.leftBarButtonItem = backItem;
}

- (void)setupAboutValue {
    
    _copyrightLabel.text = [self stringFromKey:@"TEXT_ABOUT_COPYRIGHT_TITLE" value:@"TEXT_ABOUT_COPYRIGHT_VALUE"];
    _emailLabel.text = [self stringFromKey:@"TEXT_ABOUT_EMAIL_TITLE" value:@"TEXT_ABOUT_EMAIL_VALUE"];
    _IDLabel.text = [self stringFromKey:@"TEXT_ABOUT_ID_TITLE" value:@"TEXT_ABOUT_ID_VALUE"];
    _hardwareLabel.text = [self stringFromKey:@"TEXT_ABOUT_HARDWARE_TITLE" value:@"TEXT_ABOUT_HARDWARE_VALUE"];
    _softwareLabel.text = [self stringFromKey:@"TEXT_ABOUT_SOFTWARE_TITLE" value:[SIUtil identityVersion]];
    _firmwareLabel.text = [self stringFromKey:@"TEXT_ABOUT_FIRMWARE_TITLE" value:@"TEXT_ABOUT_FIRMWARE_VALUE"];
}

- (NSString *)stringFromKey:(NSString *)key value:(NSString *)value {
    
    return [NSString stringWithFormat:@"%@ : %@", [SIUtil getSingleKeyStr:key], [SIUtil getSingleKeyStr:value]];
}

#pragma mark - Button Action

- (void)backBtnOnClick:(UIButton *)btn {
    
    [self.navigationController popViewControllerAnimated:YES];
}

@end
